package ihis.core.report;

import ihis.core.db.IHISDatabase;
import ihis.model.GeneralFilter;
import ihis.model.IHISConstants;
import ihis.model.PredictedCurve;
import ihis.model.PredictedCurveReport;
import ihis.model.Report;

import java.sql.SQLException;
import java.util.List;

public class ProjectScheduleReportFactory extends ReportFactory {

	/* (non-Javadoc)
	 * @see ihis.core.report.ReportFactory#getReport(ihis.model.GeneralFilter)
	 */
	@Override
	public Report getReport(GeneralFilter filter) {
		PredictedCurveReport report = new PredictedCurveReport();
		
		try {
			@SuppressWarnings("unchecked")
			List<PredictedCurve> valueList = IHISDatabase.getSqlMapClient().queryForList("SelectList.PredictedCurve", filter);
			
			if(valueList != null){
				report.setValueList(valueList);
			}
			
			report.setGeneralFilter(filter);
			report.setLcl(IHISConstants.LCL);
			report.setUcl(IHISConstants.UCL);
			
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		
		return report;
	}

}
